function makeAjaxRequest(url){
	$.ajax({
            type: "GET",
            url: url,
            dataType: "json",
            success : onAfterAjax
     });
}

function onAfterAjax(json){
	$('#' + json.container).html(json.content);
}

function pasteMessages(jsonMessages){
	$('#messages').remove();

	if(jsonMessages){
		var errorString = '';
		var class_name = '';
		
		for(var i in jsonMessages){
			
			if(!jsonMessages[i].type){
				class_name = 'green';				
			}else{
				class_name = 'alert';
			}
			
			if(!isNaN(1*i)){
				errorString = errorString + '<div style="width:100%" class="'+class_name+'">'+jsonMessages[i].message+'</div>';	
			}else{
				$('#'+i+'_id').parent().append('<div class="'+class_name+'">'+jsonMessages[i].message+'</div>')
			}
		}
		
		if(errorString!=''){
			$('#main').prepend('<div id="messages" class="errorDiv">'+errorString+'</div>');
		}
	}		
}

function removeMessages(){
	$('#messages').remove();
}